<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
 ?>

<?= Html::cssFile('./css/course/bootstrap.css')?>
<?= Html::cssFile('./css/course/common.css')?>
<?= Html::cssFile('./css/course/bootstrap-extends.css')?>
<?= Html::cssFile('./css/course/class-default.css')?>
<?= Html::cssFile('./css/course/web.css')?>
<?= Html::cssFile('./css/course/member.css')?>
<?= Html::cssFile('./css/course/font-awesome.min.css')?>


  <div id="content-container" class="container">


<div class="row row-12">
  <div class="col-md-12">
    <div class="panel panel-default  course-header">
      <div class="panel-body clearfix">
        <a href="http://localhost/eudsoho/web/app.php/course/2">
            <?php if($course['course_thumb']){?>
                <img class="picture" src="<?php echo 'http://files.bwphp.com/file/image/show/110/60?path='.$course['course_thumb']?>">
            <?php }else{?>
            <img class="picture" src="./css/course/coursePicture">
            <?php }?>
        </a>

        <h1 class="title"><a href="http://localhost/eudsoho/web/app.php/course/2"><?php echo $course['course_name']; ?></a>
                      <span class="label label-warning "><?php if ($course['status'] == 0) {
                        echo '未发布';
                      }elseif ($course['status'] == 1) {
                        echo "已发布";
                      }elseif ($course['status'] == 2) {
                        echo "已关闭";
                      } ?></span>
                  </h1>

        <div class="teachers">
                      教师：
             <a href="http://localhost/eudsoho/web/app.php/course/2/manage/base#modal" data-toggle="modal" data-url="/eudsoho/web/app.php/course/2/teacher/1"><?php echo $course['teacher']['teacher_name']  ?></a>
                              </div>

        <!-- <div class="toolbar hidden-xs hidden-lt-ie8">


            <div class="btn-group">
              <button class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown">预览 <span class="caret"></span></button>
              <ul class="dropdown-menu pull-right">
                  <li><a href="http://localhost/eudsoho/web/app.php/course/2?previewAs=member" target="_blank">作为 已购买用户</a></li>
                  <li><a href="http://localhost/eudsoho/web/app.php/course/2?previewAs=guest" target="_blank">作为 未购买用户</a></li>
              </ul>
            </div>
             <div class="btn-group">
                <button class="btn btn-success btn-sm course-publish-btn" data-url="/eudsoho/web/app.php/course/2/manage/publish">发布课程</button>
              </div>
          </div> -->
      </div>
    </div>


  </div>
</div>

<div class="row">
  <div class="col-md-3">
                <div class="panel panel-default">
        <div class="panel-body">
          <div class="list-group-panel">
			<?php echo $this->render('_leftnav') ?>
      </div>
      </div>
  <div class="col-md-9">

<div class="panel panel-default panel-col">
	<div class="panel-heading">基本信息</div>
	<div class="panel-body">
		 <?php
      $form = ActiveForm::begin([
                    'options' => ['class' => 'form-horizontal',
                    'id'=>'course-form'],
                    'method'=>'post',
                                    ]);
                                ?>
			<div class="form-group">
				<label class="col-md-2 control-label">标题</label>
				<div class="col-md-8 controls">
					<input type="text" id="course_title" name="course_name" required="required" class="form-control" value="<?php echo $course['course_name']; ?>" data-widget-cid="widget-1" data-explain="">

          <div class="help-block" style="display:none;"></div>
				</div>
			</div>

				<div class="form-group">
					<label class="col-md-2 control-label">连载状态</label>
					<div class="col-md-8 controls radios">
						<label><input type="radio" name="is_serialize" value="0" <?php if ($course['is_serialize']==0) {
                echo "checked='checked'";
            } ?> > 非连载课程</label>
            <label><input type="radio" name="is_serialize" value="1"  <?php if ($course['is_serialize']==1) {
                echo "checked='checked'";
            } ?>> 更新中</label>
            <label><input type="radio" name="is_serialize" value="2"  <?php if ($course['is_serialize']==2) {
                echo "checked='checked'";
            } ?>> 已完结</label>
					</div>
				</div>


			<div class="form-group">
			  <label class="col-md-2 control-label">分类</label>
			  <div class="col-md-8 controls">
			    <select id="course_typeId" name="type_id" required="required" class="form-control width-input width-input-large">
			    	<option value="0">请选择</option>
            <?php foreach ($type as $k => $v) {?>
              <?php if ($course['type_id'] == $v['type_id']) {?>
                  <option value="<?php echo $v['type_id'];  ?>" selected='selected'><?php echo $v['type_name']?></option>
              <?php }else{ ?>
              <option value="<?php echo $v['type_id'];  ?>"><?php echo $v['type_name']?></option>
            <?php }} ?>
			    </select>
			  	<div class="help-block" style="display:none;"></div>
			  </div>
			</div>

      <div class="form-group" id="date" style="<?php if ($course['type_id']!=11) {
      echo "display:none";
      } ?>">
        <label class="col-md-2 control-label">时间地点描述</label>
        <div class="col-md-8 controls">
          <input type="text" name="open_date"  class="form-control" value="<?php echo $course['open_date']; ?>" data-widget-cid="widget-1" data-explain="">
          <div class="help-block" style="display:none;"></div>
        </div>
      </div>

      <div class="form-group" id="date">


      <div class="form-group">
        <label class="col-md-2 control-label">课程难度</label>
        <div class="col-md-8 controls">
          <select id="course_rankId" name="rank_id" required="required" class="form-control width-input width-input-large">
            <option value="0">请选择</option>
            <?php foreach ($rank as $k => $v) {?>
            <?php if ($course['rank_id'] == $v['rank_id']) {?>
                  <option value="<?php echo $v['rank_id'];  ?>" selected='selected'><?php echo $v['rank_name']?></option>
              <?php }else{ ?>
              <option value="<?php echo $v['rank_id'];  ?>"><?php echo $v['rank_name']?></option>
            <?php }} ?>
          </select>
          <div class="help-block" style="display:none;"></div>
        </div>
      </div>
      <div class="form-group">
        <label class="col-md-2 control-label">课程类别</label>
        <div class="col-md-8 controls">
          <select id="course_cateId" name="cate_id" required="required" class="form-control width-input width-input-large">
            <option value="0">请选择</option>
            <?php foreach ($cate as $k => $v) {?>
            <?php if ($course['cate_id'] == $v['cate_id']) {?>
                  <option value="<?php echo $v['cate_id'];  ?>" selected='selected'><?php echo $v['cate_name']?></option>
              <?php }else{ ?>
              <option value="<?php echo $v['cate_id'];  ?>"><?php echo $v['cate_name']?></option>
            <?php }} ?>
          </select>
          <div class="help-block" style="display:none;"></div>
        </div>
      </div>
      <div class="form-group">
        <label class="col-md-2 control-label">课程来源</label>
        <div class="col-md-8 controls">
          <select id="course_categoryId" name="source_id" required="required" class="form-control width-input width-input-large">
            <option value="0">请选择</option>
            <?php foreach ($source as $k => $v) {?>
            <?php if ($course['source_id'] == $v['source_id']) {?>
                  <option value="<?php echo $v['source_id'];  ?>" selected='selected'><?php echo $v['source_name']?></option>
              <?php }else{ ?>
              <option value="<?php echo $v['source_id'];  ?>"><?php echo $v['source_name']?></option>
            <?php }} ?>
          </select>
          <div class="help-block" style="display:none;"></div>
        </div>
      </div>


			<div class="form-group">
		    <div class="col-md-offset-2 col-md-8 controls">
		    	<button class="btn btn-fat btn-primary" id="course-create-btn" type="submit">保存</button>
		    </div>
		  </div>

		  <input type="hidden" name="course_id" value="<?php echo $course['course_id'] ?>">

	<?php ActiveForm::end(); ?>
	</div>
</div>

  </div>
</div>

</div><!-- /container -->

<script>
  $('#course_typeId').change(function() {
    if ($(this).val()==11) {
        $("#date").show();
    }
    if ($(this).val()!=11) {
        $("#date").css('display', 'none');;
    }
  });

</script>